package com.gopay.remote.riskcontrol.vo;

import java.io.Serializable;

/**
 * 风控信息实体类
 * Created by Light on 2016/7/28.
 */
public class RiskControlInfo implements Serializable {
    /** 国付宝交易号 */
    private String gopayOrderId;
    /** 付款渠道*/
    private String payChannel;
    /** 银行卡号 */
    private String cardNo;
    /** 付款客户Id */
    private String payCustId;
    /** 收款客户Id */
    private String recvCustId;
    /** 登录CustId */
    private String loginCustId;
    /** 登录IP */
    private String loginIp;
    /** 注册IP */
    private String signUpIp;
    /** 注册客户ID */
    private String signUpCustId;
    /** 付款账户ID*/
    private String payAcct;

    public String getGopayOrderId() {
        return gopayOrderId;
    }

    public void setGopayOrderId(String gopayOrderId) {
        this.gopayOrderId = gopayOrderId;
    }

    public String getPayChannel() {
        return payChannel;
    }

    public void setPayChannel(String payChannel) {
        this.payChannel = payChannel;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getPayCustId() {
        return payCustId;
    }

    public void setPayCustId(String payCustId) {
        this.payCustId = payCustId;
    }

    public String getRecvCustId() {
        return recvCustId;
    }

    public void setRecvCustId(String recvCustId) {
        this.recvCustId = recvCustId;
    }

    public String getLoginCustId() {
        return loginCustId;
    }

    public void setLoginCustId(String loginCustId) {
        this.loginCustId = loginCustId;
    }

    public String getLoginIp() {
        return loginIp;
    }

    public void setLoginIp(String loginIp) {
        this.loginIp = loginIp;
    }

    public String getSignUpIp() {
        return signUpIp;
    }

    public void setSignUpIp(String signUpIp) {
        this.signUpIp = signUpIp;
    }

    public String getSignUpCustId() {
        return signUpCustId;
    }

    public void setSignUpCustId(String signUpCustId) {
        this.signUpCustId = signUpCustId;
    }

    public String getPayAcct() {
        return payAcct;
    }

    public void setPayAcct(String payAcct) {
        this.payAcct = payAcct;
    }

    @Override
    public String toString() {
        return "RiskControlInfo{" +
                "gopayOrderId='" + gopayOrderId + '\'' +
                ", payChannel='" + payChannel + '\'' +
                /**
                 * modified by zyt 对卡号做掩码显示
                 * 2017-1-20
                 */
                ", CardNo='" + getMaskedString(cardNo) + '\'' +
                //", CardNo='" + cardNo + '\'' +
                ", payCustId='" + payCustId + '\'' +
                ", recvCustId='" + recvCustId + '\'' +
                ", loginCustId='" + loginCustId + '\'' +
                ", loginIp='" + loginIp + '\'' +
                ", payAcct='" + payAcct + '\'' +'}';
    }
    
    /**
     * add by zyt 对卡号做掩码显示，因为没有引用common包，所以单独写个方法
     * @param orgStr
     * @return
     */
    private String getMaskedString(String orgStr){
		if(orgStr == null || orgStr.length() <= 0){
			return orgStr;
		}
		String dstStr = orgStr.trim();
		int length = dstStr.length();
		//大于12位，显示前6后4，等于12位，前4后4，其他情况，显示后面length/2长度
		if(length > 12){
			dstStr = dstStr.substring(0, 6) + "**** ****" 
					+ dstStr.substring(orgStr.length() - 4, orgStr.length());
		} else if (length == 12){
			dstStr = dstStr.substring(0, 4) + "**** ****" 
					+ dstStr.substring(orgStr.length() - 4, orgStr.length());
		} else {
			dstStr = "**** ****" + dstStr.substring(orgStr.length() - length/2, orgStr.length());
		}
	
		return dstStr;
	}
}
